package ThreadDemo;

import static java.lang.Thread.currentThread;

public class ThreadDemo6 {
    public static void main(String[] args) {
        Thread t1 = new Thread(()->{
            System.out.println("t1开始等待");
            try {
                currentThread().wait();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("t1结束等待");
        });
        Thread t2 = new Thread(()->{
            System.out.println("t2开始等待");
            try {
                currentThread().wait();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("t2结束等待");
        });
        t1.start();
        t2.start();
    }
}
